function SimpleTabSheet(param) {

	var that = this;
	
	this.j_tabsheet = null;
	
	var cur_tab = null;
	var count = 0;
	
	function __construct(p) {
	try{
		for(pkey in p) {
			if(pkey[0] != "_") {
				that[pkey] = p[pkey];
			}
		}
		
		initTabSheet();
	}catch(err) {
		alert(err);
	}
	}
	
	function initTabSheet() {
		jq.each(that.j_tabsheet, function(index, val) {
			var j_tab_stuff = that.j_tabsheet[index];
			var j_tab = j_tab_stuff.j_tab;
			var j_tab_content = j_tab_stuff.j_tab_content;
			var j_tab_dependency = j_tab_stuff.j_tab_dependency;
			var j_tab_selected_by_default = j_tab_stuff.j_tab_selected_by_default;
			
			j_tab.data({"index" : index, "content" : j_tab_content, "dependency" : j_tab_dependency});
			
			if(j_tab_selected_by_default === true) {
				cur_tab = j_tab;
    			showSelectedTab(j_tab);
			}
			
			j_tab.click(tabClick);
			count++;
		});
	}
	
	function tabClick(e) {
	try{
		e.preventDefault();
		
		var selected_tab = jq(this);
		
		var selected_tab_dependency = selected_tab.data("dependency");
		if(cur_tab == null) {
			showSelectedTab(selected_tab);
    		cur_tab = selected_tab_dependency;
		}else {
			if(selected_tab_dependency.data("index") === cur_tab.data("dependency").data("index")) {
				//do nothing
			}else {
				//hide current tab
				hideCurrentTab();
				//show select tab
				showSelectedTab(selected_tab);
    			cur_tab = selected_tab_dependency;
			}
		}
	}catch(err) {
		alert(err);
	}
	}
	
	function showSelectedTab(selected_tab) {
	try{
		var selected_tab_content = selected_tab.data("content");
		var selected_tab_dependency = selected_tab.data("dependency");
		
    	if(!selected_tab_dependency.hasClass("active")) {
			selected_tab_dependency.addClass("active");
    	}
    	
		if(!selected_tab_content.hasClass("active")) {
			selected_tab_content.addClass("active");
    	}
    }catch(err) {
		alert(err);
	}
	}
	
	function hideCurrentTab() {
	try{
		if(cur_tab != null) {
			var cur_tab_content = cur_tab.data("content");
			if(cur_tab.hasClass("active")) {
				cur_tab.removeClass("active");
    		}
    		if(cur_tab_content.hasClass("active")) {
				cur_tab_content.removeClass("active");
    		}
		}
    }catch(err) {
		alert(err);
	}
	}
	
	__construct(param);
	
}

